package 双指针;

/**
 * @Author：小鹿爱吃鱼
 * @Date: 2025/5/8 12:47
 * @Description:
 */
public class 盛最多水的容器 {

    public int maxArea(int[] height) {
        int i= 0;
        int j = height.length-1;
        int area = 0;
        while (i < j){
            int width = j-i;
            int he = Math.min(height[i], height[j]);
            int nowArea = width * he;
            if(nowArea > area){
                area = nowArea;
            }
            if(height[i] < height[j]){
                i++;
            }else{
                j--;
            }
        }
        return area;
    }

    public static void main(String[] args) {


    }




}
